<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jsp/jstl/core"     
    xmlns:f="http://java.sun.com/jsf/core">
    <c:if test="#{userBean.curentUser==null}">        
      
        <span class="hover" onclick="$('#UserLoginForm').arcticmodal()">Ввойти в кабинет</span>

        
        
        <div style="display: none;">
    <div class="b-modal" id="UserLoginForm">
        <div class="b-modal_close arcticmodal-close">закрыть</div>    
        <h:form   id="userAyth">
              <table>
                  <tr>
                      <td>Имя:</td>
                      <td><h:inputText id="userlogin" value="#{userBean.login}" /></td>                     
                  </tr>
                  <tr>
                      <td>Пароль:</td>
                      <td><h:inputSecret id="userpassword" value="#{userBean.password}" /></td>                    
                  </tr>
              </table>                    
            <p/><h:commandButton  id="add" value="login" action="#{userBean.checkUser}" />
        </h:form>  
    </div>
</div>
        
       
            <span class="hover" onclick="$('#UserRegForm').arcticmodal()">Регистрация</span>

        
        
        <div style="display: none;">
    <div class="b-modal" id="UserRegForm">
        <div class="b-modal_close arcticmodal-close">закрыть</div>    
        <h:form >
              <table>
                  <tr>
                      <td>Имя:</td>
                      <td><h:inputText id="userlogin" value="#{userBean.login}" /></td>                     
                  </tr>
                  <tr>
                      <td>Пароль:</td>
                      <td><h:inputSecret id="userpassword" value="#{userBean.password}" /></td>                    
                  </tr>
                  <tr>
                      <td>email:</td>
                      <td><h:inputSecret id="useremail" value="#{userBean.email}" /></td>                    
                  </tr>
                  
              </table>                    
            <p/><h:commandButton  value="Отправить" action="#{userBean.regUser}" />
        </h:form>  
    </div>
</div>
        
    </c:if>
    <c:if test="#{userBean.curentUser!=null}">
        <table>
            <tr>
                <td></td>
                <td>Привет, <a href="/ors/faces/users/userInfo.xhtml">#{userBean.curentUser.name} </a> </td>
                <td><a href="/ors/faces/users/inputMessage.xhtml">#{userBean.newUserMessage.size()} <h:graphicImage value="/ors/faces/javax.faces.resource/img/mess.png"/></a></td>
            <c:if test="#{orderBean.curentOrder != null}">
                    <td>
                               <span class="hover" onclick="$('#UserOrder').arcticmodal()">Мой заказ</span>

        

                                <div style="display: none;">
                            <div class="b-modal" id="UserOrder">
                                <div class="b-modal_close arcticmodal-close">закрыть</div>    
                               
                                <h:dataTable value="#{orderBean.curentOrder.basketsCollection}" var="o">
                                    <h:column>
                                        <h:dataTable value="#{o.itemBasketCollection}" var="a">
                                        <h:column>
                                            <f:facet name="header">Количество</f:facet>
                                            #{a.count}*#{a.idProduct.price}
                                        </h:column> 
                                            <h:column>
                                                <f:facet name="header">Наименование</f:facet>
                                             #{a.idProduct.name}   
                                            </h:column>    
                                </h:dataTable>   
                                       
                                    </h:column> 
                                </h:dataTable> 
                                <hr/>
                                Заказаные столики:
                                <h:dataTable value="#{orderBean.curentOrder.tablesCollection}" var="o">
                                    <h:column>
                                        номер столика #{o.id}
                                    </h:column>
                                </h:dataTable>
                                <hr/>
                                цена: #{orderBean.orderPrice} 
                            </div>
                        </div>
                            
                    </td>    
                </c:if>
                <td>
                    <h:form id="logout">          
                        <h:commandButton  id="login" value="Выход" action="#{userBean.logout}" actionListener="#{orderBean.userLogout}"></h:commandButton>
                    </h:form>  
                </td>
            </tr>
        </table>
        
        
        
    </c:if>

</html>
